﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package Events {
    import flash.events.*;
    import flash.utils.*;
    import Classes.*;

    public class MarketEvent extends Event {

        public static const GENERIC:int = 1;
        public static const CONTRACT:int = 2;
        public static const RESIDENCE:int = 3;
        public static const BUSINESS:int = 4;
        public static const EXPAND_FARM:int = 5;
        public static const EXTRA:int = 6;
        public static const WONDER:int = 7;
        public static const VEHICLE:int = 8;
        public static const GOODS:int = 9;
        public static const THEME_COLLECTION:int = 10;
        public static const TRAIN:int = 11;
        public static const FBC_PURCHASE:int = 12;
        public static const MYSTERY_CRATE:int = 13;
        public static const BRIDGE:int = 24;
        public static const SOURCE_INVENTORY:String = "fromInventory";
        public static const SOURCE_STORAGE:String = "fromStorage";
        public static const EQUIPMENT:int = 12;
        public static const MARKET_BUY:String = "marketbuy";
        public static const MARKET_GIFT:String = "marketgift";
        public static const MARKET_PRESENT:String = "marketpresent";

        protected static var m_itemTypeMap:Dictionary = null;

        public var item:String;
        public var eventType:int;
        public var eventSource:String;

        public function MarketEvent(_arg1:String, _arg2:int, _arg3:String, _arg4:Boolean=false, _arg5:Boolean=false, _arg6:String=""){
            this.eventType = _arg2;
            this.item = _arg3;
            this.eventSource = _arg6;
            super(_arg1, _arg4, _arg5);
        }
        public static function build(_arg1:String, _arg2:Item, _arg3:String="", _arg4:Boolean=false, _arg5:Boolean=false):MarketEvent{
            var _local6:String = _arg2.name;
            var _local7:String = _arg2.type;
            if (!m_itemTypeMap){
                initItemTypeMap();
            };
            if (m_itemTypeMap[_local7]){
                return (new MarketEvent(_arg1, m_itemTypeMap[_local7], _local6, _arg4, _arg5, _arg3));
            };
            return (new MarketEvent(_arg1, MarketEvent.GENERIC, _local6, _arg4, _arg5, _arg3));
        }
        protected static function initItemTypeMap():void{
            m_itemTypeMap = new Dictionary();
            m_itemTypeMap["tool"] = MarketEvent.EQUIPMENT;
            m_itemTypeMap["contract"] = MarketEvent.CONTRACT;
            m_itemTypeMap["residence"] = MarketEvent.RESIDENCE;
            m_itemTypeMap["business"] = MarketEvent.BUSINESS;
            m_itemTypeMap["plot_contract"] = MarketEvent.CONTRACT;
            m_itemTypeMap["storage"] = MarketEvent.GENERIC;
            m_itemTypeMap["plot"] = MarketEvent.GENERIC;
            m_itemTypeMap["factory"] = MarketEvent.GENERIC;
            m_itemTypeMap["sidewalk"] = MarketEvent.GENERIC;
            m_itemTypeMap["parking_lot"] = MarketEvent.GENERIC;
            m_itemTypeMap["decoration"] = MarketEvent.GENERIC;
            m_itemTypeMap["road"] = MarketEvent.GENERIC;
            m_itemTypeMap["pier"] = MarketEvent.GENERIC;
            m_itemTypeMap["ship"] = MarketEvent.GENERIC;
            m_itemTypeMap["harvest_ship"] = MarketEvent.GENERIC;
            m_itemTypeMap["ship_contract"] = MarketEvent.CONTRACT;
            m_itemTypeMap["expansion"] = MarketEvent.EXPAND_FARM;
            m_itemTypeMap["energy"] = MarketEvent.EXTRA;
            m_itemTypeMap["theme_collection"] = MarketEvent.THEME_COLLECTION;
            m_itemTypeMap["goods"] = MarketEvent.GOODS;
            m_itemTypeMap["municipal"] = MarketEvent.GENERIC;
            m_itemTypeMap["holidaytree"] = MarketEvent.GENERIC;
            m_itemTypeMap["landmark"] = MarketEvent.GENERIC;
            m_itemTypeMap["itemStorage"] = MarketEvent.GENERIC;
            m_itemTypeMap["starter_pack1"] = MarketEvent.FBC_PURCHASE;
            m_itemTypeMap["starter_pack2"] = MarketEvent.FBC_PURCHASE;
            m_itemTypeMap["starter_pack3"] = MarketEvent.FBC_PURCHASE;
            m_itemTypeMap["factory_contract"] = MarketEvent.CONTRACT;
            m_itemTypeMap["wonder"] = MarketEvent.WONDER;
            m_itemTypeMap["vehicle"] = MarketEvent.VEHICLE;
            m_itemTypeMap["train"] = MarketEvent.TRAIN;
            m_itemTypeMap["bridge"] = MarketEvent.BRIDGE;
            m_itemTypeMap["zooEnclosure"] = MarketEvent.GENERIC;
        }

    }
}//package Events 
